<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>

						   
<form:form modelAttribute="reservation" action="changeSeats">

<div id="messages">
<form:errors path="*" cssClass="errors" />
</div>


<div class="section">

<h3>Select Seats</h3>
<br />
<br />

<%@include file="../booking/roundtripFlightTable.jsp"%>


<br />
<br />

<%-- 
<c:forEach var="ticket" items="${reservation.ticketCollection}" varStatus="row">
Passenger ${row.index + 1 } <br/><br/>
Seat in Departure Flight (${reservation.departureFlight.flightNumber}): ${ticket.seatInDepartureFlight.number }<br/>
Seat in Returning Flight (${reservation.returnFlight.flightNumber}): ${ticket.seatInReturnFlight.number }<br/>
<br/><br/><br/><br/><br/><br/>
</c:forEach> 
<br />
<br />
--%>


<fieldset>


<c:forEach var="ticket" items="${reservation.ticketCollection}" varStatus="row">
<h6>Passenger ${row.index + 1 } </h6> 
<br/>

	<div class="field">
	<div class="label">Seat in ${reservation.departureFlight.flightNumber}:</div>
	<div class="input">
	<form:select path="ticketCollection[${row.index}].newSeatDepartureId">
	<form:option value="${reservation.ticketCollection[row.index].seatInDepartureFlight.id}" label="${reservation.ticketCollection[row.index].seatInDepartureFlight.number}" />
	<form:options itemLabel="number" itemValue="id" items="${departingSeatList}"/>
	</form:select>
	</div>
	</div>
	
	<div class="field">
	<div class="label">Seat in ${reservation.returnFlight.flightNumber}:</div>
	<div class="input">
	<form:select path="ticketCollection[${row.index}].newSeatReturningId">
	<form:option value="${reservation.ticketCollection[row.index].seatInReturnFlight.id}" label="${reservation.ticketCollection[row.index].seatInReturnFlight.number}" />
	<form:options itemLabel="number" itemValue="id" items="${returningSeatList}"/>
	</form:select>
	</div>
	</div>	

<br/><br/><br/>

</c:forEach>

</fieldset>

<br />
<br />


</div>

<div class="buttonGroup">
	<input type="submit" id="btnFindFlights" value="Change Seats" /> 
</div>


</form:form>

<br/><br/>
<a href='<c:url value="/spring/myaccount/reservations"/>'  >Select another reservation</a>
<br/><br/>
